﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TransCend.Result
{
    public abstract class AbsJsTree
    {
        /** 状态 */
        private Dictionary<string, bool> stateobj = new Dictionary<string, bool>(); 
	    protected const string Disabled = "disabled";
	    protected const string Opened = "opened";
        protected const string Selected = "selected";

	   	
	    public AbsJsTree() {
		
	    }

        public string text
        {
            get;
            set;
        }

        public string id
        {
            get;
            set;
        }


        private Dictionary<string, string> a_attrobj = null;

        public Dictionary<string, string> a_attr
        {
            get { return a_attrobj; }
            set { a_attrobj = value; }
        }
	
	    public void AddAttribute(string key, string value) {
            if (a_attrobj == null)
            {
                a_attrobj = new Dictionary<string, string>();
		    }
            a_attrobj[key] = value;
	    }


        public Dictionary<string, bool> state
        {
            get { return stateobj; }
	    }

	    /** 打开 */
	    public void SetOpened(bool b) {
            stateobj[Opened] = b;
	    }
	    /** 禁用 */
        public void SetDisabled(bool b)
        {
            stateobj[Disabled] = b;
	    }
	    /** 选中 */
        public void SetSelected(bool b)
        {
            stateobj[Selected] = b;
	    }

        private string _icon = "";
        public virtual string icon
        {
            get { return _icon; }
            set { _icon = value; }
        }
    }
}
